import myaxios from './myAxios.js';
import {BASE_URL} from '../config/index'
export const reqLogin = (values,message)=>myaxios.post(`${BASE_URL}/login`,values)
export const reqCategory = ()=>myaxios.get(`${BASE_URL}/manage/category/list`)
export const reqRolelist = ()=>myaxios.get(`${BASE_URL}/manage/role/list`)
export const reqUserList = ()=>myaxios.get(`${BASE_URL}/manage/user/role`)
export const reqProduct = (num,size)=>myaxios.get(`${BASE_URL}/manage/product/list`,{params:{num,size}})
export const reqInfo = (id)=>myaxios.get(`${BASE_URL}/manage/product/Info`,{params:{id}})
export const reqSearch = (num,size,type,keyword)=>myaxios.get(`${BASE_URL}/manage/product/search`,{params:{num,size,type,keyword}})
export const reqAddcategory =(name)=>myaxios.post(`${BASE_URL}/manage/category/add`,{categoryName:name})
export const reqUpdateproduct =(id,state)=>myaxios.post(`${BASE_URL}/manage/product/update`,{id,state})
export const reqUpdatecategory =(name,id)=>myaxios.post(`${BASE_URL}/manage/category/update`,{categoryName:name,categoryId:id})
export const reqWeather = ()=>myaxios.get('https://restapi.amap.com/v3/weather/weatherInfo?key=845c404bbb4c36b9bec9f56d2a802486&city=141127')
export const reqDelpic = (name)=>myaxios.post(`${BASE_URL}/manage/img/delete`,{name})
export const reqAddprod = (obj)=>myaxios.post(`${BASE_URL}/manage/product/add`,{...obj})
export const reqAddrole = (rolename)=>myaxios.post(`${BASE_URL}/manage/role/add`,{rolename})
export const reqAdduser = (rolename)=>myaxios.post(`${BASE_URL}/manage/user/add`,{...rolename})
export const reqUpdaterole = (rolename)=>myaxios.post(`${BASE_URL}/manage/role/update`,{...rolename,auth_time:new Date().getFullYear()+'年 '+new Date().getMonth()+1+'-'+new Date().getDate()+' '+new Date().getHours()+':'+new Date().getMinutes()+':'+new Date().getSeconds()})
export const reqUpdateprod = (obj)=>myaxios.post(`${BASE_URL}/manage/product/upd`,{...obj})
